package com.apexedu.eas.entity;

import com.apexedu.eas.exception.EasException;
import com.apexedu.util.StringUtil;
import com.apexedu.util.json.JsonUtil;
import org.codehaus.jackson.annotate.JsonIgnore;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

/**
 * 教学班信息
 * Created with IntelliJ IDEA.
 * User: ly
 * Date: 13-11-26
 * Time: 下午8:19
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "TJX_JHJXB")
@Entity
public class TjxJhjxb implements Cloneable {
	private Long id;
	private String jxbmc; //教学班名称
	private Long xn; //学年
	private Long xq; //学期
    private Long nj;//年级
	private Integer bjrs; //教学班人数
	private Long kc; //课程
	private String jcxx; //教材信息
	private Long hbKsfs; //考试方式
	private Integer zks; //总课时
	private Integer wks; //周课时
    private Integer llks;//理论课时
    private Integer syks;//实验课时
    private Integer sjxs;//实践学时
    private Integer qtxs;//其他学时
    private Integer zs;//周数
    private Integer jxblb;//教学班类别
    private Integer jxbxz;//教学班性质
    private Long hbKhfs;//考核方式
	private Double xf; //学分
	private String ls; //任课教师
	private String lsName; //任课教师姓名
	private Integer xxkkjh;
	private String bj; //班级
	private Integer jxblx; //教学班类型
	private Integer sfkpk; //是否可排课
	private Integer sfqy; //是否启用
	private Integer hbKsxz; //考试性质
	private Integer hbJslx; //教师类型
	private String bz; //备注
	private Integer czr; //操作人
	private Integer czsj; //操作时间
	private Integer sjjd; //上级节点
	private Integer cj; //层级
	private Integer zzjg; //所属院系
	private String wdlx; //文档类型
	private Integer sfyxk; //是否已选课
	private Long hbKcsx; //课程属性
	private Integer js; //教室id
	private Long zzjgSsjyz; //所属教研组
	private Integer sfkz; //是否考证
	private Long jhzap; //执行计划周安排


    private String jxblbmc;//教学班类别名称

    private  String hbKhfsMc;//考核方式名称


    //排课新增字段
    private Integer pkqr;//排课确认0:否，1:是
    private Integer ctzt;//冲突状态1:未冲突，2:有冲突
    private String ctms;//冲突描述
    private String kcmc; //课程名称
    private String kcbh; //课程编号
    private Long hb_rkkclb;//课程类别
    private String gxjg0101; //任课教师(备选)
    private Integer sfypk; //是否以排课 0:否 1:是
    private Integer sfytj; //是否已提交 0:否 1:是
    private Integer gljs; //行政班的关联教室


	/**
	 * 操作教学班时的关联教学班id
	 */
	private String jxbIds;
	/**
	 * 关联学生id
	 */
	private String xsIds;
	/**
	 * 教材名称
	 */
	private String jcmc;
	/**
	 * 班级名称
	 */
	private String bjmc;
	/**
	 * 教学班集合json字符串
	 */
	private String jsonStr;
	/**
	 * 教学班教师集合
	 */
	private List<TjxJhjxbjs> listLs = new ArrayList<TjxJhjxbjs>();
	/**
	 * 教学班教材集合
	 */
	private List<TjxJhjxbjc> listJcxx = new ArrayList<TjxJhjxbjc>();

	@javax.persistence.Column(name = "ID")
	@Id
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@javax.persistence.Column(name = "JXBMC")
	@Basic
	public String getJxbmc() {
		return jxbmc;
	}

	public void setJxbmc(String jxbmc) {
		this.jxbmc = jxbmc;
	}

	@javax.persistence.Column(name = "XN")
	@Basic
	public Long getXn() {
		return xn;
	}

	public void setXn(Long xn) {
		this.xn = xn;
	}

	@javax.persistence.Column(name = "XQ")
	@Basic
	public Long getXq() {
		return xq;
	}

	public void setXq(Long xq) {
		this.xq = xq;
	}

	@javax.persistence.Column(name = "BJRS")
	@Basic
	public Integer getBjrs() {
		return bjrs;
	}

	public void setBjrs(Integer bjrs) {
		this.bjrs = bjrs;
	}

	@javax.persistence.Column(name = "KC")
	@Basic
	public Long getKc() {
		return kc;
	}

	public void setKc(Long kc) {
		this.kc = kc;
	}

	@javax.persistence.Column(name = "JCXX")
	@Basic
	public String getJcxx() {
		return jcxx;
	}

	public void setJcxx(String jcxx) {
		this.jcxx = jcxx;
	}

	@javax.persistence.Column(name = "HB_KSFS")
	@Basic
	public Long getHbKsfs() {
		return hbKsfs;
	}

	public void setHbKsfs(Long hbKsfs) {
		this.hbKsfs = hbKsfs;
	}

	@javax.persistence.Column(name = "ZKS")
	@Basic
	public Integer getZks() {
		return zks;
	}

	public void setZks(Integer zks) {
		this.zks = zks;
	}

	@javax.persistence.Column(name = "WKS")
	@Basic
	public Integer getWks() {
		return wks;
	}

	public void setWks(Integer wks) {
		this.wks = wks;
	}

    @javax.persistence.Column(name = "NJ")
    @Basic
    public Long getNj() {
        return nj;
    }

    public void setNj(Long nj) {
        this.nj = nj;
    }

    @javax.persistence.Column(name = "LLKS")
    @Basic
    public Integer getLlks() {
        return llks;
    }

    public void setLlks(Integer llks) {
        this.llks = llks;
    }

    @javax.persistence.Column(name = "SYKS")
    @Basic
    public Integer getSyks() {
        return syks;
    }

    public void setSyks(Integer syks) {
        this.syks = syks;
    }

    @javax.persistence.Column(name = "SJXS")
    @Basic
    public Integer getSjxs() {
        return sjxs;
    }

    public void setSjxs(Integer sjxs) {
        this.sjxs = sjxs;
    }

    @javax.persistence.Column(name = "QTXS")
    @Basic
    public Integer getQtxs() {
        return qtxs;
    }

    public void setQtxs(Integer qtxs) {
        this.qtxs = qtxs;
    }

    @javax.persistence.Column(name = "HB_KHFS")
    @Basic
    public Long getHbKhfs() {
        return hbKhfs;
    }

    public void setHbKhfs(Long hbKhfs) {
        this.hbKhfs = hbKhfs;
    }

    @javax.persistence.Column(name = "ZS")
    @Basic
    public Integer getZs() {
        return zs;
    }

    public void setZs(Integer zs) {
        this.zs = zs;
    }

    @javax.persistence.Column(name = "JXBLB")
    @Basic
    public Integer getJxblb() {
        return jxblb;
    }

    public void setJxblb(Integer jxblb) {
        this.jxblb = jxblb;
    }

    @javax.persistence.Column(name = "JXBXZ")
    @Basic
    public Integer getJxbxz() {
        return jxbxz;
    }

    public void setJxbxz(Integer jxbxz) {
        this.jxbxz = jxbxz;
    }

    @javax.persistence.Column(name = "XF")
	@Basic
	public Double getXf() {
		return xf;
	}

	public void setXf(Double xf) {
		this.xf = xf;
	}

	@javax.persistence.Column(name = "GXJG0101")
	@Basic
	public String getLs() {
		return ls;
	}

	public void setLs(String ls) {
		this.ls = ls;
	}

	@javax.persistence.Column(name = "XXKKJH")
	@Basic
	public Integer getXxkkjh() {
		return xxkkjh;
	}

	public void setXxkkjh(Integer xxkkjh) {
		this.xxkkjh = xxkkjh;
	}

	@javax.persistence.Column(name = "BJ")
	@Basic
	public String getBj() {
		return bj;
	}

	public void setBj(String bj) {
		this.bj = bj;
	}

	@javax.persistence.Column(name = "JXBLX")
	@Basic
	public Integer getJxblx() {
		return jxblx;
	}

	public void setJxblx(Integer jxblx) {
		this.jxblx = jxblx;
	}

	@javax.persistence.Column(name = "SFKPK")
	@Basic
	public Integer getSfkpk() {
		return sfkpk;
	}

	public void setSfkpk(Integer sfkpk) {
		this.sfkpk = sfkpk;
	}

	@javax.persistence.Column(name = "SFQY")
	@Basic
	public Integer getSfqy() {
		return sfqy;
	}

	public void setSfqy(Integer sfqy) {
		this.sfqy = sfqy;
	}

	@javax.persistence.Column(name = "HB_KSXZ")
	@Basic
	public Integer getHbKsxz() {
		return hbKsxz;
	}

	public void setHbKsxz(Integer hbKsxz) {
		this.hbKsxz = hbKsxz;
	}

	@javax.persistence.Column(name = "HB_JSLX")
	@Basic
	public Integer getHbJslx() {
		return hbJslx;
	}

	public void setHbJslx(Integer hbJslx) {
		this.hbJslx = hbJslx;
	}

	@javax.persistence.Column(name = "BZ")
	@Basic
	public String getBz() {
		return bz;
	}

	public void setBz(String bz) {
		this.bz = bz;
	}

	@javax.persistence.Column(name = "CZR")
	@Basic
	public Integer getCzr() {
		return czr;
	}

	public void setCzr(Integer czr) {
		this.czr = czr;
	}

	@javax.persistence.Column(name = "CZSJ")
	@Basic
	public Integer getCzsj() {
		return czsj;
	}

	public void setCzsj(Integer czsj) {
		this.czsj = czsj;
	}

	@javax.persistence.Column(name = "SJJD")
	@Basic
	public Integer getSjjd() {
		return sjjd;
	}

	public void setSjjd(Integer sjjd) {
		this.sjjd = sjjd;
	}

	@javax.persistence.Column(name = "CJ")
	@Basic
	public Integer getCj() {
		return cj;
	}

	public void setCj(Integer cj) {
		this.cj = cj;
	}

	@javax.persistence.Column(name = "RKJSXM")
	@Basic
	public String getLsName() {
		return lsName;
	}

	public void setLsName(String lsName) {
		this.lsName = lsName;
	}

	@javax.persistence.Column(name = "ZZJG")
	@Basic
	public Integer getZzjg() {
		return zzjg;
	}

	public void setZzjg(Integer zzjg) {
		this.zzjg = zzjg;
	}

	@javax.persistence.Column(name = "WDLX")
	@Basic
	public String getWdlx() {
		return wdlx;
	}

	public void setWdlx(String wdlx) {
		this.wdlx = wdlx;
	}

	@javax.persistence.Column(name = "SFYXK")
	@Basic
	public Integer getSfyxk() {
		return sfyxk;
	}

	public void setSfyxk(Integer sfyxk) {
		this.sfyxk = sfyxk;
	}

	@javax.persistence.Column(name = "HB_KCSX")
	@Basic
	public Long getHbKcsx() {
		return hbKcsx;
	}

	public void setHbKcsx(Long hbKcsx) {
		this.hbKcsx = hbKcsx;
	}

	@javax.persistence.Column(name = "JS")
	@Basic
	public Integer getJs() {
		return js;
	}

	public void setJs(Integer js) {
		this.js = js;
	}

	@javax.persistence.Column(name = "ZZJG_SSJYZ")
	@Basic
	public Long getZzjgSsjyz() {
		return zzjgSsjyz;
	}

	public void setZzjgSsjyz(Long zzjgSsjyz) {
		this.zzjgSsjyz = zzjgSsjyz;
	}

	@javax.persistence.Column(name = "SFKZ")
	@Basic
	public Integer getSfkz() {
		return sfkz;
	}

	public void setSfkz(Integer sfkz) {
		this.sfkz = sfkz;
	}

	@javax.persistence.Column(name = "JHZAP")
	@Basic
	public Long getJhzap() {
		return jhzap;
	}

	public void setJhzap(Long jhzap) {
		this.jhzap = jhzap;
	}




	@Transient
	public String getJxbIds() {
		return jxbIds;
	}

	public void setJxbIds(String jxbIds) {
		this.jxbIds = jxbIds;
	}

	@Transient
	public String getXsIds() {
		return xsIds;
	}

	public void setXsIds(String xsIds) {
		this.xsIds = xsIds;
	}

	@Transient
	public String getJcmc() {
		return jcmc;
	}

	public void setJcmc(String jcmc) {
		this.jcmc = jcmc;
	}

	@Transient
	public String getBjmc() {
		return bjmc;
	}

	public void setBjmc(String bjmc) {
		this.bjmc = bjmc;
	}
    @Transient
    public String getJxblbmc() {
        return jxblbmc;
    }

    public void setJxblbmc(String jxblbmc) {
        this.jxblbmc = jxblbmc;
    }
    @Transient
    public String getHbKhfsMc() {
        return hbKhfsMc;
    }

    public void setHbKhfsMc(String hbKhfsMc) {
        this.hbKhfsMc = hbKhfsMc;
    }

    @JsonIgnore
	@Transient
	public String getJsonStr() {
		return jsonStr;
	}

	public void setJsonStr(String jsonStr) {
		this.jsonStr = jsonStr;
	}

	@JsonIgnore
	@Transient
	public List<TjxJhjxbjs> getListLs() {
		return listLs;
	}

	public void setListLs(List<TjxJhjxbjs> listLs) {
		this.listLs = listLs;
	}

	@JsonIgnore
	@Transient
	public List<TjxJhjxbjc> getListJcxx() {
		return listJcxx;
	}

	public void setListJcxx(List<TjxJhjxbjc> listJcxx) {
		this.listJcxx = listJcxx;
	}

	/**
	 * 教学班教师数量
	 *
	 * @return
	 */
	@JsonIgnore
	@Transient
	public int getLsSize() {
		return listLs == null ? 0 : listLs.size();
	}

	/**
	 * 教学班教材数量
	 *
	 * @return
	 */
	@JsonIgnore
	@Transient
	public int getJcxxSize() {
		return listJcxx == null ? 0 : listJcxx.size();
	}

	/**
	 * 教学班操作后的 产生的新教学班集合
	 *
	 * @return
	 */
	@JsonIgnore
	@Transient
	public List<TjxJhjxb> getListJxb() {
		if (StringUtil.isNotBlank(jsonStr)) {
			List<TjxJhjxb> list = JsonUtil.getDTOList(jsonStr.replaceAll("&quot;", "\""), this.getClass());
			for (TjxJhjxb jxb : list) {
				if (jxb.getListLs() != null) {
					jxb.setListLs(JsonUtil.getDTOList(JsonUtil.getJSONString(jxb.getListLs()), TjxJhjxbjs.class));
				}
				if (jxb.getListJcxx() != null) {
					jxb.setListJcxx(JsonUtil.getDTOList(JsonUtil.getJSONString(jxb.getListJcxx()), TjxJhjxbjc.class));
				}
			}
			return list;
		}
		return StringUtil.isNotBlank(jsonStr) ? JsonUtil.getDTOList(jsonStr.replaceAll("&quot;", "\""), this.getClass()) : null;
	}

	@Override
	public TjxJhjxb clone() throws EasException {
		return (TjxJhjxb) JsonUtil.getDTO(JsonUtil.getJSONString(this), TjxJhjxb.class);
	}
}
